package _10_effective_java.item3.use_enum;

/**
 * Created by bpzj on 3/24/2018.
 */
public enum SingletonEnum {
    INSTANCE,    ;

    private SingletonClass singletonClass;

    public SingletonClass getSingletonClass() {
        return singletonClass;
    }

    SingletonEnum() {
        this.singletonClass = new SingletonClass();
    }

    private class SingletonClass {
        private SingletonClass() {
        }
    }

    public static void main(String[] args) throws IllegalAccessException, InstantiationException {
        SingletonEnum singletonEnum = INSTANCE.getClass().newInstance();
        System.out.println(SingletonEnum.INSTANCE.getSingletonClass() == singletonEnum.getSingletonClass());
    }
}
